var xhr;
var addr=window.sessionStorage.getItem('url');
var msgurl=addr+"checkMessage.htm";
var username=window.sessionStorage.getItem('username');
var flag=1;
var link_msg=document.getElementById('link_msg');
link_msg.style.visibility="hidden";
if(username!=null){
	msgurl=msgurl+"?toUsername="+username;
	checkmsg();
}
function checkmsg(){
	xhr = new XMLHttpRequest();
	xhr.open("get",msgurl,true);
	xhr.onreadystatechange=msgprogress;
	xhr.send(null);
}
function msgprogress(){
	if(xhr.readyState==4){
		var json=xhr.responseText;
		var json_obj=eval("("+json+")");
		var meta=json_obj.meta;
		if(meta.state=="success"){
			if(flag==1){
				link_msg.style.visibility="visible";
				flag=0;
			}
		}
	}
}

